import { UserModule } from './module/user/user.module';
import { PhotoModule } from './module/photo/photo.module';
import { Module, CacheModule, Injectable, Logger } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import PhotoEntity from './module/photo/photo.entity';
import WeaponEntity from './module/user/model/entity/weapon.entity';
import PersonEntity from './module/user/model/entity/person.entity';
import { ScheduleModule } from '@nestjs/schedule';

// 'src/module/user/**/*.entity{.ts}'
const TypeORMConfig = TypeOrmModule.forRoot({
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: '123456',
  database: 'app_one',
  entities: [PhotoEntity, WeaponEntity, PersonEntity],
  synchronize: true,
});

@Module({
  imports: [
    TypeORMConfig,
    UserModule,
    PhotoModule,
    CacheModule.register(),
    ScheduleModule.forRoot(),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
